﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

using MvcSystemsCommander.Extensions.Security;

namespace MvcSystemsCommander.Models.ViewModel
{
    public class LoginInputModel : IInputModel
    {
        [Required]
        [Display(Name = "Username")]
        public string Username { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        public bool IsValid(string nUsername, string nPassword)
        {
            bool valid = false;

            MSCMembershipProvider provider = new MSCMembershipProvider();

            if (provider.ValidateUser(nUsername, nPassword))
            {
                valid = true;
            }

            return valid;
        }
    }
}